dojo.provide("uws.drawing.usecase.Note");
dojo.require('uws.drawing.Component');

dojo.declare('uws.drawing.usecase.Note',uws.drawing.Component,{
	constructor: function(surface,id,dx,dy, sortOrder,label,fromDS){
		this.center_x = 75;
        this.center_y = 45;
		this.sortOrder = sortOrder;
		
		if(fromDS){
			dx+=this.center_x;
			dy+=this.center_y;
		}
		
		//center circle
		/*this.group.createCircle({
			cx:this.center_x,
			cy:this.center_y,
			r:2
		}).setStroke("black").setFill("black");*/
		
		//for mouse only. invinsible
		this.actual_shape_group.createRect({
			x:5,
			y:5,
			width:145,
			height:80
		}).setFill("white").setStroke("white");
		
		this.actual_shape_group.createPath({
			path:"M4,4 l125,0 l23,16 l0,66 l-147,1z"
		}).setStroke("black");
		
		this.actual_shape_group.createPath({
			path:"M131,5 l1,13 l20,2 z"
		}).setStroke("black");
		
		/*this.label_shape = this.group.createText({
			text:label,
			x:this.center_x,
			y:(this.center_y-50+28),
			align:"middle"
		}).setFill("black").setFont(defaultFont);*/
		
		this.label_shape = this.actual_shape_group.createGroup();
		var txtArgs = {
			text: label,
			x: this.center_x-70,
			y: this.center_y-40,
			width:140,
			align: "start", 
			fitting: dojox.gfx.vectorFontFitting.FLOW,
			leading: 1,
			trailing: 1
		};
		
		var fontArgs = {
			size: "10pt", family: "Gillius"
		};
		
		try{
			vf.draw(this.label_shape, txtArgs, fontArgs, "black");
		}catch(e){
			console.debug("Catched IE bugs. Darn you, IE.");
		};
		
		this._postCreate(dx, dy);
	},
	applyProperties:function(properties){
		var txtArgs = {
			text: properties.label,
			x: this.center_x-70,
			y: this.center_y-40,
			width:140,
			align: "start", 
			fitting: dojox.gfx.vectorFontFitting.FLOW,
			leading: 1,
			trailing: 1
		};
		
		var fontArgs = {
			size: "10pt", family: "Gillius"
		};
		
		this.label_shape.removeShape();
		this.label_shape = this.actual_shape_group.createGroup();
		
		try{
			vf.draw(this.label_shape, txtArgs, fontArgs, "black");
		}catch(e){
			console.debug("Catched IE bugs. Darn you, IE.");
		};
	}
});